<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonList.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<title>竣工复验管理</title>
<script type="text/javascript">
	var keyword = null;
	var state = null;
	//装修初验
	function editItem(isEdit){
		var url = "${ctx}/renovation_firstInspectionAction.do?method=editPage&inspectionRequisitionId="+${inspectionRequisitionId } + "&isReinspection=1";
		if(isEdit){
			if(keyword==null){
				Alert('请选择一条记录');
				return;
			}
			var reinspectionState = '${ctx}/renovation_inspectionRequisitionAction.do?method=getReinspectionState&reinspectionId=' + keyword;
			new Ajax.Request(reinspectionState,{method: 'post' ,onSuccess : function(response){
				if(response.responseText == '004'){//通过复验，初验不能改
					if(state=='通过'){
						url = url + "&reinspectionId="+keyword;
					}else{
						Alert('已经有通过记录！');
						return;
					}
					top.windowOpen(url, 'firstInspection', '竣工复验管理', 280, 750);
				}else if(response.responseText == '002'){
					Alert('已经有保证金退还记录，不能修改！');
					return;
				}else{
					url = url + "&reinspectionId="+keyword;
					top.windowOpen(url, 'firstInspection', '竣工复验管理', 280, 750);
				}
			}});

		}else{
			top.windowOpen(url, 'firstInspection', '竣工复验管理', 280, 750);
		}
	}

	function itemDelete(){
	 	  if(keyword == null){
	 	   	Alert('请选择数据！');
	      return false;
	 	  }
	 	  else{
	    	AskConfirm("${key.tipsByDeleteConfirm}","ReinspectionListIForm","deleteItem");
	 	  }
	}

	function deleteItem(){
		var url = '${ctx}//renovation_reinspectionAction.do?method=deleteReinspection&keyword='+keyword;
		new Ajax.Request(url,{method: 'post' ,onSuccess : showResponse});
	}


	function showResponse(response){
		ajaxSubmitException(response.responseText);
			refresh();

	}




//刷新
	function refresh(){
			//alert("调用了！");
			window.location.reload();
	}


	//选择项
	function selectItem(item,result){
		keyword = item;
		state = result;
	}

	function closewin(){
		var obj=findFrame('inspectionRequisitionList');
		obj.parent.refresh();
		windowClose();
	}
</script>
</head>
<body>
<input name="inspectionRequisitionId" id="inspectionRequisitionId" type="hidden" value="${inspectionRequisitionId }" />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><span class="window_head_intext"><img src="${ctx}/images/ico_Advance.gif" align="absmiddle" />&nbsp;竣工复验管理</span></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td valign="middle" class="content">

	<table width="100%" border="0" cellpadding="0" cellspacing="1">
          <tr>
            <td>

<div>
  <table width="100%" border="0" cellpadding="0" cellspacing="0"   class="tab_line">
    <tr>
      <td class="bg_toolBar"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>&nbsp;</td>
          <td align="right"><!--------------------------右边图标01----------------------------------->
            <table border="0" cellpadding="0" cellspacing="0" id="ico3" >
              <tr>
                <td class="toolbarico" ><a href="#"  onClick="javascript:editItem(false);" onFocus="this.blur()"><img src="${ctx}/images/ico_newfile.gif" border="0" align="absbottom" alt="新增复验登记"/></a></td>
                <td class="toolbarico" ><a href="#"  onClick="javascript:editItem(true);" onFocus="this.blur()"><img src="${ctx}/images/ico_amend.gif" border="0" align="absbottom" alt="修改复验登记"/></a></td>
                <td class="toolbarico" ><a href="#" onClick="javascript:itemDelete();" onFocus="this.blur()"><img src="${ctx}/images/ico_delete.gif" alt="删除" width="16" height="16" border="0" align="absbottom" /></a></td>

                <td class="toolbarico">&nbsp;</td>
              </tr>
            </table>
            <!--------------------------右边图标end----------------------------------->          </td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td valign="top">
      <!-- 列表 -->
      	<ec:ceTable items="queryDataList"
			action="${ctx}/renovation_reinspectionAction.do?method=queryReinspectionList"
			var="item"
			view="pmsNoPageView"
			styleClass="gridData2"
			rowsDisplayed="15">
			<ec:ceRow styleClass="grid" onclick="selectItem('${item.keyword}','${item.result}')"  onContextMenu="return ShowContextMenu(event,'quick_rightmenu')">
				<ec:ceColumn headerCell="pmsHeadrCell" title="复验结果" property="result"   width="10%"/>
				<ec:ceColumn headerCell="pmsHeadrCell" title="复验时间" property="inspectionDate"   width="20%"><fmt:formatDate pattern="yyyy-MM-dd HH时" value="${item.inspectionDate}" /></ec:ceColumn>
				<ec:ceColumn headerCell="pmsHeadrCell" title="验收成员" property="members"  width="20%"/>
				<ec:ceColumn headerCell="pmsHeadrCell" title="备注" property="remark"   width="50%"/>
			</ec:ceRow>
		</ec:ceTable>
      </td>
    </tr>
  </table>
</div></td>
        </tr>
      </table>




	</td>
  </tr>
  <tr>
    <td colspan="2" class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>&nbsp;</td>
          <td class="btn_between_space"></td>
          <td><table border="0" cellpadding="0" cellspacing="0" style="display:none;">
              <tr>
                <td class="buttonOffLeft" id="btn1_21"></td>
                <td class="buttonOffMiddle" id="btn1_22" onClick="closewin();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onBlur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 保 存</td>
                <td class="buttonOffRight" id="btn1_23"></td>
              </tr>
          </table></td>
          <td class="btn_between_space"></td>
          <td><table border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td class="buttonOffLeft" id="btn1_31"></td>
                <td class="buttonOffMiddle" id="btn1_32" onClick="javascript:closewin();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onBlur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 关 闭</td>
                <td class="buttonOffRight" id="btn1_33"></td>
              </tr>
          </table></td>
        </tr>
          </table>
      <p>&nbsp;</p></td>
  </tr>
</table>

<!--------------------右键1---------------------->
<div id="quick_rightmenu" style="display:none;" oncontextmenu="return false" class="quick_rightmenu">
  <table width="100%" border="0" cellpadding="1" cellspacing="0" class="grid_quickMenu_bg">
    <tr>
      <td><table width="100%" border="0" cellpadding="2" cellspacing="0">
        <tr>
         <td class="quickMenu_toolbarico"><a href="#"  onClick="javascript:editItem(false);" onFocus="this.blur()"><img src="${ctx}/images/ico_newfile.gif" border="0" align="absbottom" alt="新增"/>&nbsp;新 增</a></td>
          </tr>
       <tr>
         <td class="quickMenu_toolbarico"><a href="#"  onClick="javascript:editItem(true);" onFocus="this.blur()"><img src="${ctx}/images/ico_amend.gif" border="0" align="absbottom" alt="修改"/>&nbsp;修 改</a></td>
          </tr>
        <tr>
          <td class="quickMenu_toolbarico"><a href="#" onClick="javascript:itemDelete();" onFocus="this.blur()"><img src="${ctx}/images/ico_delete.gif" alt="删 除" border="0" align="absbottom"/>&nbsp;删 除</a></td>
          </tr>
  </table>
  </td>
          </tr>
  </table>
</div>
</body>
</html>